From 2fdf0ae38dfd5fb6f7014aa7665405f89a6cc5d8 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Tue, 9 May 2023 16:59:44 -0400 Subject: [PATCH] include url in json output The input field is consistently the url of the feed, which makes sense as that is the user input, but to differentiate multiple urls downloaded from a feed when using --json-progress -J, need the url that is being downloaded too. Sponsored-By: the NIH-funded NICEMAN (ReproNim TR&D3) project --- Command/ImportFeed.hs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/Command/ImportFeed.hs b/Command/ImportFeed.hs index 2901e7628f..79c3db2943 100644 --- a/Command/ImportFeed.hs +++ b/Command/ImportFeed.hs @@ -459,14 +459,18 @@ runDownload todownload url extension cache cv getter = do ) startUrlDownload :: TMVar Bool -> ToDownload -> URLString -> CommandPerform -> CommandStart -startUrlDownload cv todownload url a = starting "addurl" - (ActionItemOther (Just (UnquotedString url))) - (SeekInput [feedurl todownload]) - (a `onException` recordfailure) +startUrlDownload cv todownload url a = do + starting "addurl" + (ActionItemOther (Just (UnquotedString url))) + (SeekInput [feedurl todownload]) + (go `onException` recordfailure) where recordfailure = do void $ feedProblem url "download failed" liftIO $ atomically $ tryPutTMVar cv False + go = do + maybeAddJSONField "url" url + a defaultTemplate :: String defaultTemplate = "${feedtitle}/${itemtitle}${extension}" -- 2.30.2